//
//  JYWelcomeViewController.swift
//  WeiBoDemo
//
//  Created by 万佳阳 on 16/8/3.
//  Copyright © 2016年 JYWan. All rights reserved.
//

import UIKit
import SDWebImage

class JYWelcomeViewController: UIViewController {
    // MARK:- 属性
    @IBOutlet weak var iconViewBottomCons: NSLayoutConstraint!
    @IBOutlet weak var iconView: UIImageView!
    
    // MARK:- 系统回调函数
    override func viewDidLoad() {
        super.viewDidLoad()
        //设置头像
        iconView.layer.cornerRadius = 45
        iconView.layer.masksToBounds = true
        
        let profileURLString = JYUserAccountViewModel.shareInstance.userAccount?.avatar_large
        let url = NSURL(string: profileURLString ?? "")
        
        iconView .sd_setImageWithURL(url, placeholderImage: UIImage(named: "avatar_default_big"))
        
        //改变约束的值
        iconViewBottomCons.constant = UIScreen.mainScreen().bounds.height - 200
        
        //执行动画
        UIView.animateWithDuration(1.5, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 5.0, options: .CurveLinear, animations: {
            self.view.layoutIfNeeded()
            }) { (_) in
                UIApplication.sharedApplication().keyWindow?.rootViewController = UIStoryboard.init(name: "Main", bundle: nil).instantiateInitialViewController()
        }
    }



}
